package org.nf.ssm.service.impl;

import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.nf.ssm.dao.NoticeDao;
import org.nf.ssm.domain.Notice;
import org.nf.ssm.service.NoticeService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zhu
 * @date 2024-10-15
 */
@Service("noticeService")
@RequiredArgsConstructor
public class NoticeServiceImpl implements NoticeService {

    private final NoticeDao noticeDao;

    @Override
    public List<Notice> getNotice(Integer adminId){
        return noticeDao.getNotice(adminId);
    }

    @Override
    public PageInfo<Notice> getAllNotice(Integer pageNum, Integer pageSize) {
        return new PageInfo<>(noticeDao.getAllNotice(pageNum, pageSize));
    }

    @Override
    public Notice getNoticeByTheme(String theme) {
        return noticeDao.getNoticeByTheme(theme);
    }

    @Override
    public void addNotice(Notice notice) {
        noticeDao.addNotice(notice);
    }

    @Override
    public void updateNotice(Notice notice) {
        noticeDao.updateNotice(notice);
    }

    @Override
    public void deleteNotice(Integer noticeId) {
        noticeDao.deleteNotice(noticeId);
    }
}
